package com.tobearc.persist.http;

import java.util.Map;

import com.tobearc.persist.http.api.HttpResponse;
import com.tobearc.persist.http.api.HttpStatus;
import com.tobearc.persist.http.api.HttpVersion;

/**
 * 
 * @author yangqifan
 */
public class HttpResponeImpl implements HttpResponse {
	 private final HttpVersion version;
	 private final HttpStatus status;
	 private final Map<String, String> headers;

	 public HttpResponeImpl(HttpVersion version, HttpStatus status, Map<String, String> headers){
		 this.version = version;
		 this.status = status;
		 this.headers = headers;
	 }
	 
	public HttpVersion getProtocolVersion() {
		return version;
	}

	public String getContentType() {
		return headers.get("content-type");
	}

	public boolean isKeepAlive() {
		return false;
	}

	public String getHeader(String name) {
		return headers.get(name);
	}

	
	public boolean containsHeader(String name) {
		return headers.containsKey(name);
	}

	public Map<String, String> getHeaders() {
		return headers;
	}

	public HttpStatus getStatus() {
		return status;
	}

}
